﻿    // 基于准备好的dom，初始化echarts实例
    //点击统计
    var djtj = echarts.init(document.getElementById('djtj'), 'shine');
//订单统计
var ddtj = echarts.init(document.getElementById('ddtj'), 'shine');
////预估统计
var ygtj = echarts.init(document.getElementById('ygtj'), 'shine');
////结算统计
var jstj = echarts.init(document.getElementById('jstj'), 'shine');

get_list();

function get_list() {
    //alert(1);


    $.ajax({
        type: "post",
        url: "/agentcenter/GetTGTJ",
        data: {
            pi: 1,
            dateType: 0

        },
        dataType: "json",
        success: function (data) {
            if (data.State) {
                var list = data.Datas;
                //点击统计
                djtj.setOption({
                    title: {
                        text: '点击统计',
                        textStyle: { color: '#62a8ea' }
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    grid: {
                        left: '3%',
                        right: '12%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        //left: 'center',
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        data: list.dateTime
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        name: '点击',
                        type: 'bar',
                        itemStyle: { normal: { color: '#0098d9' } },
                        data: list.djtj,
                        markPoint: {
                            data: [
                                { type: 'max', name: '最大值' },
                                { type: 'min', name: '最小值' }
                            ]
                        },
                        markLine: {
                            data: [
                                { type: 'average', name: '平均值' }
                            ]
                        }
                    }]
                });

                //订单统计
                ddtj.setOption({
                    title: {
                        text: '订单统计',
                        textStyle: { color: '#46be8a' }
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    grid: {
                        left: '3%',
                        right: '12%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        // left: 'center',
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        data: list.dateTime
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        name: '订单',
                        type: 'bar',
                        //lineStyle: { normal: { color: '#46be8a' } },
                        //areaStyle: { normal: { color: '#46be8a' } },
                        itemStyle: { normal: { color: '#46be8a' } },
                        data: list.ddtj,
                        markPoint: {
                            data: [
                                { type: 'max', name: '最大值' },
                                { type: 'min', name: '最小值' }
                            ]
                        },
                        markLine: {
                            data: [
                                { type: 'average', name: '平均值' }
                            ]
                        }
                    }]
                });

                //预估统计
                ygtj.setOption({
                    title: {
                        text: '预估统计',
                        textStyle: { color: '#f2a654' }
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    grid: {
                        left: '3%',
                        right: '12%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        data: list.dateTime
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        name: '预估',
                        type: 'bar',
                        itemStyle: { normal: { color: '#f2a654' } },
                        data: list.ygtj,
                        markPoint: {
                            data: [
                                { type: 'max', name: '最大值' },
                                { type: 'min', name: '最小值' }
                            ]
                        },
                        markLine: {
                            data: [
                                { type: 'average', name: '平均值' }
                            ]
                        }

                    }]
                });

                //结算统计
                jstj.setOption({
                    title: {
                        text: '点击统计',
                        textStyle: { color: '#57c7d4' }
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    grid: {
                        left: '3%',
                        right: '12%',
                        bottom: '3%',
                        containLabel: true
                    },

                    toolbox: {
                        feature: {
                            dataZoom: {
                                yAxisIndex: 'none'
                            },
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        data: list.dateTime
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        name: '结算',
                        type: 'bar',
                        itemStyle: { normal: { color: '#57c7d4' } },
                        data: list.jstj,
                        markPoint: {
                            data: [
                                { type: 'max', name: '最大值' },
                                { type: 'min', name: '最小值' }
                            ]
                        },
                        markLine: {
                            data: [
                                { type: 'average', name: '平均值' }
                            ]
                        }
                    }]
                });

            }

        },
        error: function (data) {

        }

    })




}
